<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<%=basePath%>">
		
		<meta charset="utf-8" />
		<title></title>
		
		<meta name="description" content="overview & stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="static/css/bootstrap.min.css" />
		<link rel="stylesheet" href="static/css/bootstrap-responsive.min.css" />
		<link rel="stylesheet" href="static/css/font-awesome.min.css" />
		<!--[if IE 7]><link rel="stylesheet" href="css/font-awesome-ie7.min.css" /><![endif]-->
		<!--[if lt IE 9]><link rel="stylesheet" href="css/ace-ie.min.css" /><![endif]-->
		<link rel="stylesheet" href="static/css/ace.min.css" />
		<link rel="stylesheet" href="static/css/ace-responsive.min.css" />
		<link rel="stylesheet" href="static/css/ace-skins.min.css" />
		
		<script type="text/javascript" src="static/1.9.1/jquery.min.js"></script>
		<script type="text/javascript">
			window.jQuery
					|| document
							.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");
		</script>
		<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="static/js/ace-elements.min.js"></script>
		<script type="text/javascript" src="static/js/ace.min.js"></script>
		<script type="text/javascript" src="static/js/bootbox.min.js"></script>
	
		<!--引入弹窗组件start-->
		<script type="text/javascript" src="plugins/js/attention/zDialog/zDrag.js"></script>
		<script type="text/javascript" src="plugins/js/attention/zDialog/zDialog.js"></script>
		<!--引入弹窗组件end-->
		
<script type="text/javascript">
	$(window.parent.hangge());	
	
	//新增
	function addOperPrivilege(moduleid){
		 window.parent.jzts();
		 var diag = new top.Dialog();
		 diag.Drag=true;
		 diag.Title ="新增操作权限";
		 diag.URL = '<%=basePath%>/module/toAddOperPrivilege.do?moduleid='+moduleid;
		 diag.Width = 223;
		 diag.Height = 256;
		 diag.CancelEvent = function(){ //关闭事件
			if(diag.innerFrame.contentWindow.document.getElementById('centerOfMainFrame').style.display == 'none'){
				window.parent.jzts(); 
				setTimeout("location.reload()",100);
			}
			diag.close();
		 };
		 diag.show();
	}
	
	//修改
	function editOperPrivilege(operprivilegeid){
		 window.parent.jzts();
	   	 var diag = new top.Dialog();
		 diag.Drag=true;
		 diag.Title ="编辑操作权限";
		 diag.URL = '<%=basePath%>/module/toEditOperPrivilege.do?operprivilegeid='+operprivilegeid;
		 diag.Width = 223;
		 diag.Height = 256;
		 diag.CancelEvent = function(){ //关闭事件
			if(diag.innerFrame.contentWindow.document.getElementById('centerOfMainFrame').style.display == 'none'){
				window.parent.jzts(); 
				setTimeout("location.reload()",100);
			}
			diag.close();
		 };
		 diag.show();
	}
	
	function delOperPrivilege(operprivilegeid){
		var flag = false;
		if(confirm("确定要删除该操作权限吗？")){
			flag = true;
		}
		
		if(flag){
			var url = "<%=basePath%>/module/deleteOperPrivilege.do?operprivilegeid="+operprivilegeid+"&guid="+new Date().getTime();
			$.get(url,function(data){
				if (data == "success") {
					window.parent.jzts();
					document.location.reload();
				}
			});
		}
	}
</script>
</head>

<body>
	<table id="table_report" class="table table-striped table-bordered table-hover">
		<thead>
		<tr>
			<th class="center"  style="width: 50px;">序号</th>
			<th class='center'>名称</th>
			<th class='center'>资源路径</th>
			<th class='center'>操作</th>
		</tr>
		</thead>
		<c:choose>
			<c:when test="${not empty operPrivilegeList}">
				<c:forEach items="${operPrivilegeList}" var="operPrivilege" varStatus="vs">
					<tr id="tr${operPrivilege.operprivilegeid }">
					<td class="center">${vs.index+1}</td>
					<td class='center'> ${operPrivilege.opername } </td>
					<td>${operPrivilege.operurl}</td>
					<td style="width: 25%;">
						<a class='btn btn-mini btn-info' title="编辑" onclick="editOperPrivilege('${operPrivilege.operprivilegeid }')" ><i class='icon-edit'></i></a>
						<a class='btn btn-mini btn-danger' title="删除"  onclick="delOperPrivilege('${operPrivilege.operprivilegeid }')"><i class='icon-trash'></i></a>
					</tr>
				</c:forEach>
			</c:when>
			<c:otherwise>
				<tr>
					<td colspan="100">没有相关数据</td>
				</tr>
			</c:otherwise>
		</c:choose>
	</table>
	<div class="page_and_btn">
		<div>
			&nbsp;&nbsp;<a class="btn btn-small btn-success" onclick="addOperPrivilege('${pageData.moduleid }');">新增</a>
		</div>
	</div>
</body>
</html>